package kikoqiu;

import kikoqiu.flex.Consumer;
import flex.messaging.io.amf.client.exceptions.ClientStatusException;
import flex.messaging.io.amf.client.exceptions.ServerStatusException;
import flex.messaging.messages.AsyncMessage;

public class Test extends Consumer {
	@Override
	public void onAsyncMessage(AsyncMessage msg) {
		System.out.println("We got an AsyncMessage:\n"+msg);
	}

	public Test(String url, String destination, String subTopic) {
		super(url, destination, subTopic);
	}
	
	public static void main(String[] args) {
		Consumer cm=new Test("http://localhost:8080/blazeds/messagebroker/amfpolling", "myDest", "myTopic");
		try {
			cm.subscribe();
			//ok, never return!
			cm.getPollingThread().join();
		} catch (ClientStatusException e) {
			e.printStackTrace();
		} catch (ServerStatusException e) {
			e.printStackTrace();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

}
